package com.cl.cloud.binlog.handler;

import com.cl.cloud.binlog.model.BinlogPositionEntity;
import com.cl.cloud.binlog.properties.DbConfig;
import com.cl.core.common.exception.ServerException;

/**
 * @description: 位点处理器
 * @author: liuzijian
 * @time: 2022-07-08 11:44
 */
public interface PositionHandler {

    /**
     * 获取当前binlog配置的位点信息
     *
     * @param dbConfig 需要监听的数据库配置
     * @return 位点信息
     * @throws ServerException
     */
    BinlogPositionEntity getPosition(DbConfig dbConfig) throws ServerException;

    /**
     * 保存当前binlog的位点信息
     *
     * @param dbConfig             需要监听的数据库配置
     * @param binlogPositionEntity 位点信息
     * @throws ServerException
     */
    void savePosition(DbConfig dbConfig, BinlogPositionEntity binlogPositionEntity) throws ServerException;

}
